# 作者：yjh2011@live.com
# 功能：设定datetime中的UTC时区
# 案例：datetime.datetime.now(UTC(8))

import datetime


class UTC(datetime.tzinfo):
    """UTC"""

    def __init__(self, offset=0):
        self._offset = offset

    def utcoffset(self, dt):
        return datetime.timedelta(hours=self._offset)

    def tzname(self, dt):
        return "UTC +%s" % self._offset

    def dst(self, dt):
        return datetime.timedelta(hours=self._offset)